using System;
using System.Collections.Generic;
using System.Text;

using System.Xml.XPath;
using System.Xml.Xsl;

namespace BadHabit.Factory.Reports {



    public class ResourceReport : Report {

        private static Data.ResourceReportDataSetTableAdapters.AssigneeEffortByMonthTableAdapter effortTA = new BadHabit.Factory.Data.ResourceReportDataSetTableAdapters.AssigneeEffortByMonthTableAdapter();


        private int month;
        private int year;

         /// <summary>
        /// Implements a Report class to generate a backlog report.
        /// </summary>
        /// <param name="factory"></param>
        public ResourceReport(Factory factory, int month, int year) : base(factory) {
            this.month = month;
            this.year = year;
        }


        /// <summary>
        /// The template type name.
        /// </summary>
        public override string TemplateTypeName {
            get {
                return "ResourceReport";
            }
        }

        /// <summary>
        /// Adjusts the dataset for XPS render.
        /// </summary>
        /// <param name="projectUId">The projectUId</param>
        /// <returns>The adjusted dataset</returns>
        public override System.Data.DataSet CreateDataSet() {
            Data.ResourceReportDataSet report = report = new Data.ResourceReportDataSet();
            report.EnforceConstraints = false;
            effortTA.FillByMonth(report.AssigneeEffortByMonth, month, year);
            return report;
        }


        public override System.Data.DataSet AdjustDataSet(System.Data.DataSet report) {                       

            report = base.AdjustDataSet(report);

            report.Tables.Add("GeneralRes");

            report.Tables["GeneralRes"].Columns.Add("monthName");
            report.Tables["GeneralRes"].Columns.Add("actualMonth");
            report.Tables["GeneralRes"].Columns.Add("actualYear");
            DateTime newDate = new DateTime(year, month, 1);
            report.Tables["GeneralRes"].Rows.Add(new object[] { newDate.ToString("MMMM"), DateTime.Now.Month, DateTime.Now.Year });


           
            return report;
        }



    }
}
